home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource4
/
269_01
/
manual2.doc
< prev
next >
Wrap
Text File
|
1987-05-17
|
22KB
|
990 lines
E
Unicorn Library Documentation 3.1 page 47
__________________________________________________________________
ellipser
F
Plots an ellipse on the graphics screen. The ellipse may be
rotated in 6 degree increments from 0 to 90 degrees. To obtain
full 360 degree rotation the major axis may be defined as either
x or y with rotation.
Call: ellipser(xc, yc, rotate, r1, r2, color);
xc = column coordinate of center
yc = row coordinate of center
rotate = angle of rotation (0, 6, 12, 18 etc.)
r1 = half the distance along the x-axis (columns)
r2 = half the distance along the y axis (rows)
color = color of the ellipse
Example: main()
{
sm(4); /* set graphics mode */
/* draw an ellipse in color 2 rotated 48 degrees */
ellipser(100,100,48, 50, 80, 2);
}
Unicorn 1 Documentation 3.1 page 48
__________________________________________________________________________
equip
Returns an integer idicative of the equipment contained on the PC. The
number may be interpreted as follows:
bit 0 - diskette installed
bit 1 - not used
bit 2, 3 - always 11
bit 4, 5 - initial video mode
01 = 40 x 25 BW
10 = 80 x 25 BW
bit 6, 7 - number of diskette drives ( only if bit 0 = 1)
00 = 1
01 = 2
bit 8 - 0 = dma present
1 = no dma on system
bit 9, 10, 11 - number of RS-232 cards installed
bit 12 - game I/O attached
bit 13 - not used
bit 14, 15 - number of printers
Call: equip();
Example: main()
{
equip(); /* get current equipment status */
}
E
Unicorn Library Documentation 3.1 page 49
___________________________________________________________________
factrl
F
Returns the factorial of an integer as a double.
Call: factrl(8);
Example: main()
{
double a;
a = factrl(21);
}
E
Unicorn Library Documentation 3.1 page 50
__________________________________________________________________
fibon
F
Returns the integer sum of all the integers up to and including
the passed parameter.
Call: fibon(number);
number = ending point of adding numbers
Example: main()
{
int a;
a = fibon(5);
}
E
Unicorn Library Documentation 3.1 page 51
__________________________________________________________________
forward
F
Moves the turtle (turtle graphics) in its current direction by a
specified distance. The distance is measured in pixels.
Call: forward(pixels);
pixels = number of pixels to move in current direction
Example: main()
{
sm(4); /* set graphics mode */
pendown(); /* set pen down on screen to draw */
forward(50); /* move forward 50 pixels */
}
E
Unicorn Library Documentation 3.1 page 52
__________________________________________________________________
fpower
F
Returns fractional powers of doubles. It works only with positive
numbers although the power may be negative.
Call: fpower(number, pow);
number = double value to raise to a power
pow = double power
Example: main()
{
fpower(5.67, 2.43);
Unicorn 1 Documentation 3.1 page 53
__________________________________________________________________________
getchne
Get a character from the standard input with no echo.
Call: getchne();
Example: main()
{
int a;
a = getchne(); /* return a character in a with no echo */
}
Unicorn 1 Documentation 3.1 page 54
__________________________________________________________________________
getctype
Returns an integer indicating the type of IBM-PC.
return:
FFh = Original IBM-PC
FEh = PC XT, portable PC or PC with revised system board
FDh = PCjr
FCh = PC-AT
Call: getctype();
Example: main()
{
int a;
a = getctype(); /* find what type of machine it is */
if (a==255)
printf("This is an original IBM-PC");
}
E
Unicorn Library Documentation 3.1 page 55
__________________________________________________________________
getcurp
F This returns the current position of the cursor on the screen in
row, column format.
Call: getcurp(&row, &column);
row = the current cursor row position
column = the current cursor column position
Example: main()
{
getcurp(row, column);
}
Unicorn 1 Documentation 3.1 page 56
__________________________________________________________________________
gliss
Produces a sliding sound or glissando using the IBM mode of sound
production.
Call: gliss(beg, end, rate);
beg = starting frequency
end = ending frequency
rate = rate of increase/decrease. a larger rate slows it down
Example: main()
{
gliss(300, 2000, 1); /* rapid slide from 300 to 2000 cycles*/
gliss(2000, 300, 10); /* slower slide down from 2000 to
300 cycles */
}
E
Unicorn Library Documentation 3.1 page 57
__________________________________________________________________
gothic
F Displays Gothic characters on the graphics screen. All characters
are displayed in a 16 pixel wide by 20 pixel high matrix.
Call: gothic(char, ulc, ulr, color);
char = character to print
ulc = upper left corner column
ulr = upper left corner row
color = color of the character
Example: main()
{
sm(4); /* set graphics mode */
/* print a gothic W at 20, 30 in color 3 */
gothic('W', 20, 30, 3);
}
E
Unicorn Library Documentation 3.1 page 58
___________________________________________________________________
hollow
F
This function prints outline characters on the graphics screen. The
characters are defined in a 16 column by 30 row pixel matrix.
Call: hollow(char, ulc, ulr, color);
char = character to print
ulc = upper left corner column
ulr = upper left corner row
color = color of the character
Example: main()
{
sm(4); /* set graphics mode */
/* print an outline W at 20, 30 in color 3 */
hollow('W', 20, 30, 3);
}
E
Unicorn Library Documentation 3.1 page 59
___________________________________________________________________
ifactrl
F
Returns the integer factorial of an integer.
Call: ifactrl(number);
number = value to use in finding the factorial
Example: main()
{
int a;
a = ifactrl(23);
}
E
Unicorn Library Documentation 3.1 page 60
__________________________________________________________________
indexch
F Returns the position of a character withing a string.
Call: indexch(str, ch);
str = string to be searched
ch = character to search for
Example: main()
{
/* find the position of the character 'i' */
/* should return a 2 */
indexch("This is a test", 'i');
}
E
Unicorn Library Documentation 3.1 page 61
__________________________________________________________________
indexr
F Returns the rightmost position of a character in a given string.
Returns -1 if the character is not found in the string.
Call: indexr(str, ch);
str = string to be searched
ch = character to search for
Example: main()
{
/* find the rightmost poistion of 'i' in "this is a
test". Should return 5 */
indexr("This is a test", 'i');
}
E
Unicorn Library Documentation 3.1 page 62
___________________________________________________________________
lfactrl
F
Returns a long integer factorial of a number.
Call: lfactrl(number);
number = integer value used in finding the factorial
Example: main()
{
long a;
a = lfactrl(54);
}
E
Unicorn Library Documentation 3.1 page 63
__________________________________________________________________
lgstr
F This function uses the ROM internal dot character descriptions to
place a magnified character string on the graphics screen.
Call: lgstr(string, ulc, ulr, hmag, vmag, color);
string = string to print
ulc = upper left corner column
ulr = upper left corner row
hmag = horizontal magnification
vmag = vertical magnification
color = color of character
Example: main()
{
sm(4); /* set graphics mode */
/* print the string "Test" double sized in color 1 */
lgstr("Test", 10, 40, 2, 2, 1);
}
E
Unicorn Library Documentation 3.1 page 64
__________________________________________________________________
line
F Draws a line on the graphics screen given the two endpoints and
the color.
Call: line(x1, y1, x2, y2, color);
x1, y1 = end point coordinates
x2, y2 = second end point coordinates
color = color of the line
Example: main()
{
sm(4); /* set the graphics mode */
/* draw a line in color 3 from 30,50 to 180, 140 */
line(30,50,180,140,3);
}
E
Unicorn Library Documentation 3.1 page 65
__________________________________________________________________
locate
F Returns the color of a pixel on the graphics screen.
Call: variable = locate(row, column);
variable = the return variable
row = the row of the pixel
column = the column of the pixel
Example: main()
{
int a;
sm(4); /* set graphics mode */
/* find the color of the pixel located at 100, 110 */
a = locate(100,110);
/* print it out */
printf("The color of the pixel at 100, 110 is %d\n", a);
}
Unicorn 1 Documentation 3.1 page 66
__________________________________________________________________________
lprintf
Send a string to line printer 1.
Call: lprintf(string);
string = a pointer to string to be printed on printer
Example: main()
{
lprintf("This is a test"); /* send string to printer */
}
Unicorn 1 Documentation 3.1 page 67
__________________________________________________________________________
lputch
This function prints a single character to the printer. It is limited to
supporting only line printer #1.
Call: lputch(char);
char = the character to be printed.
Return: printer status
bit 0 = timeout occurred
bit 1 = [unused]
bit 2 = [unused]
bit 3 = I/O error
bit 4 = selected
bit 5 = out of paper
bit 6 = acknowledge
bit 7 = not busy
Example: main()
{
char a;
a = 'x';
lputch(a); /* print the letter 'x' on the printer */
/* at the current print head location */
}
Unicorn 1 Documentation 3.1 page 68
__________________________________________________________________________
memsize
Returns an integer containing the number of kilobytes of memory installed.
Call: memsize();
Example: main()
{
int a;
a = memsize(); /* get kilobytes of memory */
}
E
Unicorn Library Documentation 3.1 page 69
__________________________________________________________________
moveto
F Moves the turtle pen to an absolute pixel location without
drawing.
Call: moveto(col, row);
col = the new column coordinate
row = the new row coordinate
Example: main()
{
sm(4); /* set the graphics mode */
/* move the turtle pen to 100, 30 */
moveto(100, 30);
}
E
Unicorn Library Documentation 3.1 page 70
__________________________________________________________________
note
F Tandy 1000 only
Plays a musical tone on the internal speaker. This function
includes all sharps and flats and a total of 7 octaves. The user
is given access to all three voices and full control over the
volume.
Future versions will include duration for added control over the
note.
Call: note(voice, octave, note, volume);
voice = 1, 2, or 3 ( selects sound channel)
octave = 1 - 7 with 1 being the lowest
note = note from below table
volume = 0 (off) to 15 (loudest)
A - 1 octave 3 contains middle C
A# - 2
B - 3
C - 4
C# - 5
D - 6
D# - 7
E - 8
F - 9
G - 10
G# - 11
E
Unicorn Library Documentation 3.1 page 71
__________________________________________________________________
paint
F Fills an area containing a seed point and bounded by a single color
with a specified color.
Call: paint(column, row, paintc, boundry);
column = column coordinate of seed point inside boundry
row = row coordinate of seed point inside boundry
paintc = color to paint the enclosed region
boundry = color of the boundry to the region to fill
Example: main()
{
sm(4); /* set graphics mode */
/* draw a circle */
circle(100,100,50,1,1,3);
/* paint the circle (watch the border color! */
paint(100,100,2,3);
}
E
Unicorn Library Documentation 3.1 page 72
__________________________________________________________________
palette
F IBM-PC only
Changes the palette or color set to be used on an IBM-PC.
Call: palette(a, b, c);
a = the palette number (0 to 3)
b = mode ( 4-normal, 5- extra or highlighted color sets)
c = background color
Example: main()
{
sm(4); /* set the graphics mode */
/* set the color set to highlighted palette 2 with a
blue background. */
palette(2, 5, 1);
}
E
Unicorn Library Documentation 3.1 page 73
__________________________________________________________________
pencolor
F Sets the turtle graphics pen color.
Call: pencolor(color);
color = the pen color to use. may be 0-3 for IBM or
0-16 for Tandy 1000
Example: main()
{
sm(4); /* set graphics mode */
/* change pen color to 3 */
pencolor(3);
}
E
Unicorn Library Documentation 3.1 page 74
__________________________________________________________________
pendown
F Places the turtle graphics "pen down" on the screen so that it
may draw.
Call: pendown();
Example: main()
{
sm(4); /* set the graphics mode */
/* place the pen down in preperation for drawing */
pendown();
}
E
Unicorn Library Documentation 3.1 page 75
__________________________________________________________________
penup
F Lift the pen up so that it may be moved without drawing.
Call: penup();
Example: main()
{
sm(4); /* set the graphics mode */
/* lift up the pen */
penup();
}
Unicorn 1 Documentation 3.1 page 76
__________________________________________________________________________
phasor
Make a phasor sound.
Call: phasor();
Example: main()
{
phasor(); /* make phasor sound */
}
E
Unicorn Library Documentation 3.1 page 77
__________________________________________________________________
point
F Light up a single pixel in a specified color.
Call: point(column, row, color);
column = the pixel column
row = the pixel row
color = color to light the pixel
Example: main()
{
sm(4); /* set the graphics mode */
/* light the pixel at 110,110 in color 3 */
point(110, 110, 3);
}
E
Unicorn Library Documentation 3.1 page 78
__________________________________________________________________
power
F
Raise a number to a power. The number is a float but the power
must be an integer.
Call: power(number, pow);
number = floating point value to take to a power
pow = integer power
Example: main()
{
power(6.78, 3);
}